package com.yeswater.es.test;

import org.apache.http.HttpHost;
import org.elasticsearch.client.RestClient;
import org.elasticsearch.client.RestHighLevelClient;
import sun.tools.jar.CommandLine;

import java.io.IOException;

/**
 * author： yeswater
 * create： 2024/4/2
 */
public class ESTest_Client {
    public static void main(String[] args) throws IOException {
        // 创建 es客户端
        RestHighLevelClient client = new RestHighLevelClient(RestClient.builder(new HttpHost("localhost", Integer.parseInt("9200"),"http")));
        System.out.println(client);
        // 关闭es客户端
        client.close();
    }
}
